<script>
export default {
    props: {
        totalPrice: String,
        selectedNum: Number,
        cartItems:Array,
    },
    computed:{
        selectAll:{
            get(){
                return this.cartItems.every(function(item){
                    return item.isSelected == true;
                })
            },
            set(newValue){
                if(newValue){
                    this.cartItems.forEach(function(item){
                        item.isSelected = true;
                    })
                }else{
                    this.cartItems.forEach(function(item){
                        item.isSelected = false;
                    })
                }
            }
        }
    }

}
</script>

<template>
    <div class="cartFooter" id="cartFooter">
        <div class="selall fl">
            <label for="fl select-all">
                <input type="checkbox" class="check-all check" v-model="selectAll"/>
                <span><a href="#" class="selallSPAN">&nbsp;全选</a></span>
            </label>
        </div>
        <a href="#" id="multiDelete" class="fl delete">多 选 删 除</a>
        <a href="#" id="allDelete" class="fl delete">清 空 购 物 车</a>
        <div class="fr closing">结 算</div>
        <div class="fr total">合计:￥<span id="priceTotal">{{ totalPrice }}</span></div>
        <div class="fr selected" id="selected">
            已选商品
            <span id="selectedTotal">{{ selectedNum }}</span>件

        </div>
        <div class="selected-view">
            <div id="selectedViewList" class="clearfix">

            </div>
            <span class="arrow">◆<span>◆</span></span>
        </div>
    </div>
</template>